<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script type="text/javascript" src="${staticServer}/common/js/const.js"></script>
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>

<script>
var contextPath='${contextPath}';
$(function(){
$( "#btnSubmit" ).click( function(e){
		saveQuestion();
	});
$("#jd_center").val("<#if practice??>${practice.jd_center}<#else><#if region!=''>${region}</#if></#if>");
$("#cs_center").val("<#if practice??>${practice.cs_center}<#else><#if bool!=''>${region}<#else>未测评</#if></#if>");
$("#region").val("<#if practice??>${practice.center}</#if>");
$("#shi1").val("<#if shi??>${shi}</#if>");	
$("#fen1").val("<#if fen??>${fen}</#if>");	
$("#miao1").val("<#if miao??>${miao}</#if>");	

})

saveQuestion = function() {
	var practiceId = $("#practiceId").val();
	var stu_id = $("#stu_id").val();
	var stu_name = $("#nickname").val();
	var tea_id = $("#tea_id").val();
	var course_type = $("#course_type").val();
	var student_msg = $("#student_msg").val();
	var stime = $("#stime").val();
	var center = $("#region").val();
	var to_name = $("#to_name").val();	
	var cs_center = $("#cs_center").val();
	var stattime = $("#stattime").val();		
	var shi1 = $("#shi1").val();
	var fen1 = $("#fen1").val();		
	var miao1 = $("#miao1").val();	
	var beizhu = $("#beizhu").val();	
	var phone = $("#phone").val();
	var member = $("#member").val();
	var jd_center = $("#jd_center").val();
	
	var stat ="";
	if (stu_name == '') {
		infopad.err("学员姓名不能为空");
		return;
	}
	if (center == '') {
		infopad.err("训练中心不能为空");
		return;
	}
	if (cs_center == '') {
		infopad.err("测评中心不能为空");
		return;
	}
	if (phone == '') {
		infopad.err("电话号码不能为空");
		return;
	}
	if (stime == '') {
		infopad.err("测评日期不能为空");
		return;
	}
	if (course_type == '') {
		infopad.err("请填写训练课时");
		return;
	}
	if (student_msg == '') {
		infopad.err("学员情况不能为空");
		return;
	}
	if(phone == ''){
		infopad.err("电话不能为空");
		return;
	}
	if(jd_center == ''){
		infopad.err("接待中心不能为空");
		return;
	}
	
	if(stattime == '' || shi1 == '' || fen1 == '' || miao1 == ''){
		infopad.err("方案使用时间不能为空");
		return;
	}else{
		stat = stattime+"+"+shi1+"."+fen1+"."+miao1
	}
	
	$.post(contextPath+"/index/add_apply.json", {
		"id":practiceId,
		"stu_id" : stu_id,
		"stu_name" : stu_name,
		"tea_id" : tea_id,
		"course_type" : course_type,
		"student_msg":student_msg,
		"stime" : stime,
		"center" : center,
		"stat": stat,
		"phone":phone,
		"member":member,
		"cs_center":cs_center,
		"to_name":to_name,
		"beizhu":beizhu,
		"jd_center":jd_center
	}, function(ms) {
	      if(ms.msg == "1"){
		     	infopad.msg("申请成功");
			  	setTimeout(function(){
				window.location.href = contextPath+"/index/plan_apply.htm";
			},1000);
	      }else{
	      		alert("抱歉，系统忙,请重新保存！");
	      }
		

	});

};

$(function(){
	$("#province1").keyup(function(){
		var province = $("#province1").val();
		getCenter(1,province);
	});
	
	$("#province2").keyup(function(){
		var province = $("#province2").val();
		getCenter(2,province);
	});
});

var getCenter = function(type,province){
	$.post(contextPath+"/index/getcenter.json", {
		"province":province
	}, function(ms) {
		if(ms.office!=null){
			if(type==1){
				$("#region").val(ms.office.name);
			}else if(type==2){
				$("#cs_center").val(ms.office.name);
			}
		}
	});
}
</script>
</head>

<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>
	<input type="hidden" id="stu_id" value="<#if list??>${list.id}<#else>${practice.stu_id}</#if>">
	<input type="hidden" id="tea_id" value="<#if user??>${user.id}<#else>${practice.tea_id}</#if>">
	<input type="hidden" id="practiceId" value="<#if practice??>${practice.id}</#if>">
	<input type="hidden" id="to_name" value="<#if user??>${user.nickname}<#else>${practice.to_name}</#if>">
	
	
	<div id="container">
		<div id="title">title</div>
	<table id="infotable">
			<tr class="fields">
				<th colspan="2">填写方案<a id="btn_detailed"></a></th>
			</tr>
			<tr>
				<th width="25%">选择学员*</th>
				<td width="75%"><input id="nickname" value="<#if list??>${list.nickname}<#else>${practice.stu_name}</#if>"/></td>
			</tr>
			
			<tr>
				<th width="25%">训练中心*</th>
				<td width="75%">
					<select id="region">
						<option value="">--请选择训练中心--</option>
						<option value="上门训练">上门训练</option>
                		<#if office_List??>
                			<#list office_List as list>
                				<option value="${list.name}">${list.name}</option>
                			</#list>
                		</#if>
                	</select>
                	<input placeholder="快捷搜索选择" id="province1" type="text" value="">
				</td>
			</tr>
			
			<tr>
				<th width="25%">测评中心*</th>
				<td width="75%">
					<select id="cs_center">
						<option value="">--请选择测评中心--</option>
						<option value="未测评">未测评</option>
                		<#if office_List??>
                			<#list office_List as list>
                				<option value="${list.name}">${list.name}</option>
                			</#list>
                		</#if>
                	</select>
                	<input placeholder="快捷搜索选择" id="province2" type="text" value="">
				</td>
			</tr>
				<tr>
				<th width="25%">接待中心*</th>
				<td width="75%">
					<select id="jd_center">
						<option value="">--请选择接待中心--</option>
                		<#if office_List??>
                			<#list office_List as list>
                				<option value="${list.name}">${list.name}</option>
                			</#list>
                		</#if>
                	</select>
                	<input placeholder="快捷搜索选择" id="province2" type="text" value="">
				</td>
			</tr>
			
				<tr>
					<th class="zt_widthlabel" width="25%">测评日期*</th>
					<td colspan="2" width="75%">
					<input type="text" name="stime" id="stime" maxlength="15" size="19" value="<#if practice??>${practice.first}</#if>" rel="DATE::Y-m-d" />  
					（若未测评，需填写接待日期。）
					</td>
				</tr>
				
				<tr>
					<th class="zt_widthlabel" width="25%">会员号</th>
					<td colspan="2" width="75%">
					<input type="text" name="member" id="member" value="<#if list??>${list.card}<#else>${practice.loginName}</#if>"/>  
					</td>
				</tr>
				<tr>
					<th class="zt_widthlabel" width="25%">电话号码*</th>
					<td colspan="2" width="75%">
					<input type="text" name="phone" id="phone" value="<#if list??>${list.phone}<#else>${practice.phone}</#if>"/>  
					</td>
				</tr>
				<tr>
					<th class="zt_widthlabel" width="25%">训练课时*</th>
					<td colspan="2" width="75%">
					<input type="text" name="course_type"  id="course_type" maxlength="15" size="30" value="<#if list??><#else>${practice.course_type}</#if>" />  
					</td>
				</tr>	
				<tr>
					<th class="zt_widthlabel" width="25%">学员情况*</th>
					<td colspan="2" width="75%">
						<textarea style="width:600px;height:150px;" type="text" id="student_msg" class="input w300" ><#if list??>${list.feature}。 学员是否属于中心加家庭结合训练：<#if list.type?contains("ab")>（是）<#else>（否）</#if><#else>${practice.student_msg}</#if>。 </textarea>
					</td>
				</tr>

				<tr>
					<th class="zt_widthlabel" width="25%">方案使用时间*</th>
					<td colspan="2" width="75%">
					<input type="text" name="stattime" id="stattime" maxlength="15" size="15" value="<#if date2?? && date2!=''>${date2}</#if>"  rel="DATE::Y-m-d">
                	<select id="shi1">
							<option value="">时</option>
							<option value="01">01</option>
							<option value="02">02</option>
							<option value="03">03</option>
							<option value="04">04</option>
							<option value="05">05</option>
							<option value="06">06</option>
							<option value="07">07</option>
							<option value="08">08</option>
							<option value="09">09</option>
  							<option value="10">10</option>
  							<option value="11">11</option>
  							<option value="12">12</option>
  							<option value="13">13</option>
  							<option value="14">14</option>
  							<option value="15">15</option>
  							<option value="16">16</option>
  							<option value="17">17</option>
  							<option value="18">18</option>
  							<option value="19">19</option>
  							<option value="20">20</option>
  							<option value="21">21</option>
  							<option value="22">22</option>
  							<option value="23">23</option>
  							<option value="00">00</option>
					</select>
                	<select id="fen1">
							<option value="">分</option>
							<option selected="selected" value="00">00</option>
							<option value="01">01</option>
							<option value="02">02</option>
							<option value="03">03</option>
							<option value="04">04</option>
							<option value="05">05</option>
							<option value="06">06</option>
							<option value="07">07</option>
							<option value="08">08</option>
							<option value="09">09</option>
  							<option value="10">10</option>
  							<option value="11">11</option>
  							<option value="12">12</option>
  							<option value="13">13</option>
  							<option value="14">14</option>
  							<option value="15">15</option>
  							<option value="16">16</option>
  							<option value="17">17</option>
  							<option value="18">18</option>
  							<option value="19">19</option>
  							<option value="20">20</option>
  							<option value="21">21</option>
  							<option value="22">22</option>
  							<option value="23">23</option>
  							<option value="24">24</option>
  							<option value="25">25</option>
  							<option value="26">26</option>
  							<option value="27">27</option>
  							<option value="28">28</option>
  							<option value="29">29</option>
  							<option value="30">30</option>
  							<option value="31">31</option>
  							<option value="32">32</option>
  							<option value="33">33</option>
  							<option value="34">34</option>
  							<option value="35">35</option>
  							<option value="36">36</option>
  							<option value="37">37</option>
  							<option value="38">38</option>
  							<option value="39">39</option>
  							<option value="40">40</option>
  							<option value="41">41</option>
  							<option value="42">42</option>
  							<option value="43">43</option>
  							<option value="44">44</option>
  							<option value="45">45</option>
  							<option value="46">46</option>
  							<option value="47">47</option>
  							<option value="48">48</option>
  							<option value="49">49</option>
  							<option value="50">50</option>
  							<option value="51">51</option>
  							<option value="52">52</option>
  							<option value="53">53</option>
  							<option value="54">54</option>
  							<option value="55">55</option>
  							<option value="56">56</option>
  							<option value="57">57</option>
  							<option value="58">58</option>
  							<option value="59">59</option>
					</select>
                	<select id="miao1">
                			<option value="">秒</option>
                			<option selected="selected" value="00">00</option>
							<option value="01">01</option>
							<option value="02">02</option>
							<option value="03">03</option>
							<option value="04">04</option>
							<option value="05">05</option>
							<option value="06">06</option>
							<option value="07">07</option>
							<option value="08">08</option>
							<option value="09">09</option>
  							<option value="10">10</option>
  							<option value="11">11</option>
  							<option value="12">12</option>
  							<option value="13">13</option>
  							<option value="14">14</option>
  							<option value="15">15</option>
  							<option value="16">16</option>
  							<option value="17">17</option>
  							<option value="18">18</option>
  							<option value="19">19</option>
  							<option value="20">20</option>
  							<option value="21">21</option>
  							<option value="22">22</option>
  							<option value="23">23</option>
  							<option value="24">24</option>
  							<option value="25">25</option>
  							<option value="26">26</option>
  							<option value="27">27</option>
  							<option value="28">28</option>
  							<option value="29">29</option>
  							<option value="30">30</option>
  							<option value="31">31</option>
  							<option value="32">32</option>
  							<option value="33">33</option>
  							<option value="34">34</option>
  							<option value="35">35</option>
  							<option value="36">36</option>
  							<option value="37">37</option>
  							<option value="38">38</option>
  							<option value="39">39</option>
  							<option value="40">40</option>
  							<option value="41">41</option>
  							<option value="42">42</option>
  							<option value="43">43</option>
  							<option value="44">44</option>
  							<option value="45">45</option>
  							<option value="46">46</option>
  							<option value="47">47</option>
  							<option value="48">48</option>
  							<option value="49">49</option>
  							<option value="50">50</option>
  							<option value="51">51</option>
  							<option value="52">52</option>
  							<option value="53">53</option>
  							<option value="54">54</option>
  							<option value="55">55</option>
  							<option value="56">56</option>
  							<option value="57">57</option>
  							<option value="58">58</option>
  							<option value="59">59</option>
					</select>
					</td>
				</tr>
				
				<tr>
					<th class="zt_widthlabel" width="25%">备注</th>
					<td colspan="2" width="75%">
						<textarea style="width:400px;height:80px;" type="text" id="beizhu" class="input w300" ><#if practice??>${practice.beizhu}</#if></textarea>
					</td>
				</tr>
		</table>
		
		<div id="controlbar" style="width: 49%;">
			<input  id="btnSubmit" type="button" class="submit" value=" 保存方案  " /> 
		</div>
	</div>
	<div class="emptyline"></div>
</body>
</html>